/*
** parse_map.c for epikong in /home/florian/nibbler/epikong/etape_1/srcs
** 
** Made by Florian Coulon
** Login   <coulon_a@epitech.net>
** 
** Started on  Sat Mar  3 06:13:03 2012 Florian Coulon
** Last update Sat Mar  3 09:14:38 2012 Florian Coulon
*/

#include	<unistd.h>
#include	<stdlib.h>
#include	<stdio.h>

#include	"epikong.h"

extern char	*tab_test;
extern int	map_param[2];



static int	test_caract(char c)
{
  static int	i = 0;
  
  while (tab_test[i])
    {
      if (c == tab_test[i])
	return (i);
    }
  return (FALSE);
}

int		test_map(FILE *fd)
{
  char		c;

  c = fgetc(fd);
  while (c != EOF)
    {
      if (test_caract(c) == FALSE)
	{
	  write(1, "Please enter a good map\n", 24);
	  return (FALSE);
	}
      if (c != '\n' && map_param[0])
	map_param[1]++;
      if (c == '\n')
	map_param[0]++;
      c = fgetc(fd);
    }
  return (TRUE);
}
